package com.gkzf.ai.module.crm.controller.app.simpleCredit;

import com.gkzf.ai.framework.common.pojo.CommonResult;
import com.gkzf.ai.module.crm.controller.app.simpleCredit.vo.condition.UserAdmittanceConditionRespVO;
import com.gkzf.ai.module.crm.controller.app.simpleCredit.vo.condition.UserAdmittanceConditionSaveReqVO;
import com.gkzf.ai.module.crm.service.creditreportsimple.app.AppUserAdmittanceConditionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import static com.gkzf.ai.framework.common.pojo.CommonResult.success;


@Tag(name = "App后台 - CRM 小程序用户补充信息准入条件")
@RestController
@RequestMapping("/app/user-admittance-condition")
@Validated
public class UserAdmittanceConditionController {

    @Resource
    private AppUserAdmittanceConditionService appUserAdmittanceConditionService;


    @PutMapping("/update")
    @Operation(summary = "更新/添加 小程序用户补充信息准入条件")
    public CommonResult<Boolean> updateUserAdmittanceCondition(@Valid @RequestBody UserAdmittanceConditionSaveReqVO updateReqVO) {
        appUserAdmittanceConditionService.updateUserAdmittanceCondition(updateReqVO);
        return success(true);
    }


    @GetMapping("/getUserInfo")
    @Operation(summary = "获得 小程序用户补充信息准入条件")
    public CommonResult<UserAdmittanceConditionRespVO> getUserAdmittanceConditionList(@RequestParam("userOpenId")String userOpenId) {
        UserAdmittanceConditionRespVO respVO = appUserAdmittanceConditionService.getUserAllAdmittanceCondition(userOpenId);
        return success(respVO);
    }


}